home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-24 | 774 b | 34 lines | [TEXT/AxoC] |
- Procedure dec2hex(dec: Integer)
- VAR
- i,j,k,hex: Integer
- leftZeros: Boolean
- begin
- leftZeros = true
- for i = 1 to 8 do
- begin
- j = 16 ^ (8 - i)
- hex = dec DIV j
- if hex <> 0 then leftZeros = false
- if not leftZeros then
- begin
- dec = dec - hex * j
- if hex = 0 then write ('0')
- if hex = 1 then write ('1')
- if hex = 2 then write ('2')
- if hex = 3 then write ('3')
- if hex = 4 then write ('4')
- if hex = 5 then write ('5')
- if hex = 6 then write ('6')
- if hex = 7 then write ('7')
- if hex = 8 then write ('8')
- if hex = 9 then write ('9')
- if hex = 10 then write ('A')
- if hex = 11 then write ('B')
- if hex = 12 then write ('C')
- if hex = 13 then write ('D')
- if hex = 14 then write ('E')
- if hex = 15 then write ('F')
- end
- end
- end
-